<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="format-detection" content="telephone=no">
    <!-- 去除浏览器地址栏和菜单栏 -->
    <meta name='apple-mobile-web-app-capable' content='yes' />
    <meta name='full-screen' content='true' />
    <meta name='x5-fullscreen' content='true' />
    <meta name='360-fullscreen' content='true' />
    <title>知命</title>
    <!--[if lt IE 9]>  
        <script src="http://cdn.bootcss.com/html5shiv/r29/html5.js"></script>
        <script src="https://cdn.bootcss.com/respond.__PUBLIC__/js/1.4.2/respond.min.js"></script>    
    <![endif]-->
    <script src="__PUBLIC__/js/rem.js"></script>
    <script src="__PUBLIC__/js/echarts.min.js"></script>
    <!-- <script src="__PUBLIC__/js/Anles.js"></script> -->
    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <style>
        *{margin:0;padding:0;}
    </style>
</head>
<body>
    <div id="progress" style="height:100vh;width:100%;"></div>

    <script>
        
        (function getval(){
            $.get("<!--{:U('Index/loopSecond','',false)}-->",function(data){
                console.log(data)
                if(data>=120||data%10==0){
                    $.get("<!--{:U('Index/loopSecondUpdate','',false)}-->",function(data){})
                }
                if(data >= 0){
                    setTimeout(function(){
                        echartsPro(countDown(data),data)
                        getval();
                    },1000)
                }else{
                    var wzurl='<!--{$wzurl}-->';
                    location.href=wzurl;
                    return false;
                }
            })
        })();

        function countDown(time){
            // time 单位秒
            let dayNum;
            let hours;
            let ddNum = Math.floor( time % (24*3600)); 
            let minutesNum = ddNum%(3600);         
            let minutes = Math.floor(minutesNum/(60));
            let secondNum = ddNum%(60)
            let second = Math.floor(secondNum);
            hours = Math.floor(time / (3600));
            return [fillNum(hours),fillNum(minutes),fillNum(second)]
        }
        function fillNum(num){
            if(num > 9){
                return num;
            }else{
                return '0'+num;
            }
        }
        function echartsPro(timeArr,time){
            var progress = echarts.init(document.querySelector('#progress'));
            var option = {
                // backgroundColor:new echarts.graphic.LinearGradient(
                //     1, 0, 0, 1,
                //     [
                //         {offset: 0, color: '#04EFD3'},
                //         {offset: 1, color: '#05C6E5'}
                //     ]
                // ),
                animation:false,
                title:[
                    {
                        text:'正在为您生成分析报告',
                        x:'center',
                        y:'53%',
                        textStyle:{
                            fontSize:18,
                            color:'#333333',
                            fontWeight:'normal',

                        }
                    },
                ],
                series: [
                    {
                        name:'本次测试中的得分',
                        type:'pie',
                        radius: ['50%', '55%'],
                        center:['50%','35%'],
                        avoidLabelOverlap: false,
                        hoverAnimation:false,
                        left:'50%',
                        itemStyle:{
                            normal:{
    
                            }
                        },
                        label: {
                            normal: {
                                show: true,
                                position:'center',
                                fontSize:27,
                                color:'#333333',
                            },
                        },
                        labelLine: {
                            normal: {
                                show: false
                            }
                        },
                        data:[
                            {value:time, name:timeArr[1]+':'+timeArr[2],},
                            {value:(120-time),name:''},
                        ],
                        color: ['#CE283E','#cccccc']
                        
                        
                    }
                ]
            };
            progress.setOption(option)
        }
        
    </script>
</body>
</html>